<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.util.CommonUtil"%>
<%@ page import="com.lp.authority.WechatAuthorityIntercept"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
  <%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
  <link rel="shortcut icon" href="<%=basePath%>/image/oss/iot/favicon2.ico" type="image/x-icon">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="<%=basePath%>/lib/layui/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="<%=basePath%>/lib/layui/layuiadmin/style/admin.css" media="all">
  

</head>
<body class="layui-layout-body">
  
  <div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
      <div class="layui-header">
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
          <li class="layui-nav-item layadmin-flexible" lay-unselect>
            <a href="javascript:;" layadmin-event="flexible" title="Side expansion">
              <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" >
            <a target="_blank" href="<%=basePath%>/page/bigscreen/index.html">
              	Large-screen display
            </a>
          </li>
        </ul>
        <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
          
          <li class="layui-nav-item" lay-unselect>
            <a lay-href="<%=basePath%>/service/iot/alarm_manager"  lay-text="Message center">
              <i class="layui-icon layui-icon-notice"></i>
              <span class="layui-badge-dot alarm-message"></span>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="fullscreen">
              <i class="layui-icon layui-icon-screen-full"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs"> 
          	<span class="user-type">${user.data.type }</span>
			<!--<c:choose>
			  <c:when test="${user.data.type eq '超级管理员'}"><span class="user-type">Super</span></c:when>
			  <c:when test="${user.data.type eq '管理员'}"><span class="user-type">Administrator</span></c:when>
			  <c:when test="${user.data.type eq '普通用户'}"><span class="user-type">Normal</span></c:when>
			</c:choose>-->
          </li>
          <li class="layui-nav-item" lay-unselect  style="margin-right: 30px;">
            <a href="javascript:;">
              <cite>
              	<c:if test="${user.nick_name !=null}">
				 	 ${user.nick_name }
				 </c:if>
				 <c:if test="${user.nick_name ==null}">
				 	 ${user.name}
				 </c:if>
              </cite>
            </a>
            <dl class="layui-nav-child" style="padding: 0;">
              <dd><a style="text-align: center;" lay-href="<%=basePath%>/service/iot/user_detail">Personal information</a></dd>
              <dd><a style="text-align: center;" lay-href="<%=basePath%>/service/iot/user_info" >Change password</a></dd>
              <hr style="margin: 0;">
              <dd style="text-align: center;cursor:pointer;"><a onclick="logout()" > Exit account</a></dd>
            </dl>
          </li>
        </ul>
      </div>
      
      <!-- 侧边菜单 -->
      <div class="layui-side layui-side-menu">
        <div class="layui-side-scroll">
          <div class="layui-logo" lay-href="<%=basePath%>/service/iot/app_map">
          	<!-- <span><img style="width: 30px;margin-top: -2px;margin-right: 3px;" src="<%=basePath%>/image/oss/iot/logo13.png">
          	</span> -->
            <span><%=ProConfig.SYS_INFO_NAME%></span>
          </div>
          
          <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
            <li data-name="home" class="layui-nav-item layui-nav-itemed">
              <a href="javascript:;" lay-tips="Platform overview" lay-direction="2">
                <i class="layui-icon layui-icon-home"></i>
                <cite>Platform overview</cite>
              </a>
              <dl class="layui-nav-child">
                <dd data-name="console" class="layui-this">
                  <a lay-href="<%=basePath%>/service/iot/app_map">
                  	<i class="layui-icon layui-icon-right"></i>Project information</a>
                </dd>
                <dd data-name="console">
                  <a lay-href="<%=basePath%>/service/iot/device_location">
                  	<i class="layui-icon layui-icon-right"></i>Device map</a>
                </dd>
                <dd data-name="console">
                  <a lay-href="<%=basePath%>/service/iot/app_status">
                  	<i class="layui-icon layui-icon-right"></i>System statistics</a>
                </dd>
              </dl>
            </li>
            <li data-name="component" class="layui-nav-item">
              <a href="javascript:;" lay-tips="Real-time monitoring" lay-direction="2">
                <i class="layui-icon layui-icon-component"></i>
                <cite>Real-time monitoring</cite>
              </a>
              <dl class="layui-nav-child">
                <dd data-name="button">
                  <a lay-href="<%=basePath%>/service/iot/monitor">
                  	<i class="layui-icon layui-icon-right"></i> Device monitoring</a>
                </dd>
                <dd data-name="button2">
                  <a lay-href="<%=basePath%>/service/iot/device_list">
                  	<i class="layui-icon layui-icon-right"></i> List monitoring</a>
                </dd>
                
                <c:if test="${ user.type == 10 || user.type == 8  }">
                	<dd data-name="Visual">
	                	<a lay-href="<%=basePath%>/service/iot/visual_list">
	                  	<i class="layui-icon layui-icon-right"></i> Config monitoring</a>
                  	</dd>
                </c:if>
                <c:if test="${ user.type == 11111  }">
                    <dd data-name="nav">
                        <a lay-href="<%=basePath%>/service/iot/mvideo">
                            <i class="layui-icon layui-icon-right"></i>Video surveillance</a>
                    </dd>
                </c:if>

              </dl>
            </li>
            <li data-name="template" class="layui-nav-item">
              <a href="javascript:;" lay-tips="Alarm message" lay-direction="2">
                <i class="layui-icon layui-icon-template"></i>
                <cite>Alarm message</cite>
              </a>
              <dl class="layui-nav-child">
                <dd><a lay-href="<%=basePath%>/service/iot/alarm_manager">
                	<i class="layui-icon layui-icon-right"></i>Unread alarm</a></dd>
                <dd><a lay-href="<%=basePath%>/service/iot/alarm_all">
                	<i class="layui-icon layui-icon-right"></i>All alarm</a></dd>
              </dl>
            </li>
            
            <li data-name="history" class="layui-nav-item">
              <a href="javascript:;" lay-tips="Historical data" lay-direction="2">
                <i class="layui-icon layui-icon-chart"></i>
                <cite>Historical data</cite>
              </a>
              <dl class="layui-nav-child">
                <dd><a lay-href="<%=basePath%>/service/iot/history_sensor_data">
                	<i class="layui-icon layui-icon-right"></i>Device history data</a></dd>
                <dd><a lay-href="<%=basePath%>/page/myhtml/index.html">
                	<i class="layui-icon layui-icon-right"></i>Device history analysis</a></dd>
                <dd><a lay-href="<%=basePath%>/service/iot/history_trigger_data">
                	<i class="layui-icon layui-icon-right"></i>Device history trigger</a></dd>
              </dl>
            </li>
            
            <li data-name="app" class="layui-nav-item">
              <a href="javascript:;" lay-tips="User management" lay-direction="2">
                <i class="layui-icon layui-icon-user"></i>
                <cite>User information</cite>
              </a>
              <dl class="layui-nav-child">
               <c:if test="${user.type == 10 || user.type == 8 }">
	                <dd>
	                  <a lay-href="<%=basePath%>/service/iot/user_manager">
	                  	<i class="layui-icon layui-icon-right"></i>Sub-account</a>
	                </dd>
                </c:if>
                 <dd>
	                 <a lay-href="<%=basePath%>/service/iot/user_detail">
	                  	<i class="layui-icon layui-icon-right"></i>Personal information</a>
                  </dd>
                  <dd>
	                  <a lay-href="<%=basePath%>/service/iot/user_info">
	                  	<i class="layui-icon layui-icon-right"></i>Change password</a>
                  </dd>
              </dl>
            </li>
           
            
             <c:if test="${user.type == 10 || user.type == 8 || user.type == 7}">
            	<li data-name="appm" class="layui-nav-item">
	              <a href="javascript:;" lay-href="<%=basePath%>/service/iot/app_manager" lay-tips="Project management" lay-direction="2">
	                <i class="layui-icon layui-icon-app"></i>
	                <cite>Project management</cite>
	              </a>
	            </li>
            </c:if>
            
             <c:if test="${user.type == 10 || user.type == 8 || user.type == 7}">
	            <li data-name="setDE" class="layui-nav-item">
	              <a href="javascript:;" lay-tips="Device management" lay-direction="2">
	                <i class="layui-icon layui-icon-engine"></i>
	                <cite>Device management</cite>
	              </a>
	              <dl class="layui-nav-child">
	              	<dd>
	                  <a lay-href="<%=basePath%>/service/iot/gateway_manager">
	                  	<i class="layui-icon layui-icon-right"></i>Device information</a>
	                </dd>
<%--	                <dd>--%>
<%--	                  <a lay-href="<%=basePath%>/service/iot/video_manager">--%>
<%--	                  	<i class="layui-icon layui-icon-right"></i>Video information</a>--%>
<%--	                </dd>--%>
	              </dl>
	            </li>
            </c:if>
            <c:if test="${ user.type == 10 || user.type == 8  }">
	            <li data-name="visualMager" class="layui-nav-item">
	              <a href="javascript:;" lay-tips="Config management" lay-direction="2">
	                <i class="layui-icon layui-icon-engine"></i>
	                <cite>Config management</cite>
	              </a>
	              <dl class="layui-nav-child">
	              	<dd>
	                  <a lay-href="<%=basePath%>/service/iot/visual_manager">
	                  	<i class="layui-icon layui-icon-right"></i>Configuration list</a>
	                </dd>
	                <c:if test="${ user.type == 10 }">
	                <dd>
	                  <a lay-href="<%=basePath%>/page/visual/moudleManagement.html">
	                  	<i class="layui-icon layui-icon-right"></i>Component config</a>
	                </dd>
	                </c:if>
	              </dl>
	            </li>
            </c:if>
            
            <c:if test="${user.type == 10 || user.type == 8 }">
	            <li data-name="trigger" class="layui-nav-item">
	              <a href="javascript:;" lay-tips="Trigger management" lay-direction="2">
	                <i class="layui-icon layui-icon-senior"></i>
	                <cite>Trigger management</cite>
	              </a>
	              <dl class="layui-nav-child">
	                <dd>
	                  <a lay-href="<%=basePath%>/service/iot/trigger_manager">
	                  	<i class="layui-icon layui-icon-right"></i>Trigger list</a>
	                </dd>
	                <dd data-name="workorder">
	                  <a lay-href="<%=basePath%>/service/iot/contact_user_manager">
	                  	<i class="layui-icon layui-icon-right"></i>Alarm contact</a>
	                </dd>
	              </dl>
	            </li>
            </c:if>
            
            <c:if test="${user.type == 10 }">
	            <li data-name="system" class="layui-nav-item">
	            	 <a href="javascript:;" lay-tips="System setting" lay-direction="2">
		                <i class="layui-icon layui-icon-set"></i>
		                <cite>System management</cite>
		              </a>
		              <dl class="layui-nav-child">
		              	 <dd>
		                  <a lay-href="<%=basePath%>/service/base/user">
		                  	<i class="layui-icon layui-icon-right"></i>User list</a>
		                </dd>
		                 <dd>
		                  <a lay-href="<%=basePath%>/service/base/smsStatistic">
		                  	<i class="layui-icon layui-icon-right"></i>Service statistics</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/app">
		                  	<i class="layui-icon layui-icon-right"></i>Item list</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/device">
		                  	<i class="layui-icon layui-icon-right"></i>Device list</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/device_house">
		                  	<i class="layui-icon layui-icon-right"></i>Device warehouse</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/sensorico">
		                  	<i class="layui-icon layui-icon-right"></i>Icon management</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/dictionary">
		                  	<i class="layui-icon layui-icon-right"></i>Data dictionary</a>
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/lpm">
		                  	<i class="layui-icon layui-icon-right"></i>LPM management</a> 
		                </dd>
		                <dd>
		                  <a lay-href="<%=basePath%>/service/base/sys">
		                  	<i class="layui-icon layui-icon-right"></i>System parameter</a> 
		                </dd>
		              </dl>
	            </li>
           </c:if>
          </ul>
        </div>
      </div>
      
      <!-- 主体内容 -->
      <div class="layui-body" id="LAY_app_body">
        <div class="layadmin-tabsbody-item layui-show">
          <iframe src="<%=basePath%>/service/iot/app_map" frameborder="0" class="layadmin-iframe"></iframe>
        </div>
      </div>
      
      <!-- 辅助元素，一般用于移动设备下遮罩 -->
      <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
  </div>
  <script type="text/javascript" src="<%=basePath%>/lib/jquery/jquery-1.8.3.min.js"></script>
  <script src="<%=basePath%>/lib/layui/layuiadmin/layui/layui.js"></script>
  
 
   <script> 
 	  layui.config({
 	  	base: '<%=basePath%>/lib/layui/layuiadmin/' 
 	  }).extend({
 	    index: 'lib/index' //主入口模块
 	  }).use('index');
	  
 	  function logout(){
 		 localStorage.removeItem("ucode");
 		 window.location.href = localUrl + "/user/logout" ;
 	  }
 	  
	  $(function(){
		// 登录成功，则将user-key写到cookie
		localStorage.setItem("ucode", userKey);
		
		getAlarmCount();
			
		function getAlarmCount(){
			postAjax(localUrl+"/alarm/unread", {iot_alarm_process_status:46},function(data){
				if( data.status == 2 ){
					if(data.count!=0)
						$(".alarm-message").show();
					else{
						$(".alarm-message").hide();
					}
				}
			})			
		}
			
			// 报警消息定时刷新
			setInterval(function(){
				getAlarmCount();
			}, 1*30*1000);
		  
			function postAjax(url, data,sucessCallBack, errorCallBack) {
				if(typeof(userKey)=="undefined"){
					userKey='';
				}
				$.ajax({
					type : "POST",
					url : url,
					contentType : "application/json",
					dataType : "json",
					async : true,
					headers : {
						'USER-KEY' :userKey 
					},
					data : JSON.stringify(data),
					success : function(data){
						sucessCallBack(data);
					},
					error : errorCallBack
				})
			};
		  
	  })
		
  </script>
  
</body>
</html>
